package com.itheima.chapter10.thread.demo8;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

//线程优先级
public class Demo {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        MyCallable mc =new MyCallable();
        FutureTask<String > ft =new FutureTask<>(mc);
        Thread t =new Thread(ft);
        t.setName("线程一");
        System.out.println(t.getPriority());
        System.out.println(t);
        t.setPriority(10);
        System.out.println(t.getPriority());


        MyCallable mc1 =new MyCallable();
        FutureTask ft1 =new FutureTask(mc1);
        Thread t1 =new Thread(ft1);
        t1.setName("线程二");
        System.out.println(t1.getPriority());
        System.out.println(t1);
        t1.setPriority(7);
        System.out.println(t.getPriority());

        t.start();
        t1.start();
       /* String s = ft.get();
        System.out.println(s);
        System.out.println(ft1.get());
    */}
}
